<template>
  <el-dialog title="拒绝" :visible.sync="dialogVisible" width="500px">
    <el-form :model="form">
      <el-form-item label="原因：" label-width="120px">
        <el-input
          type="textarea"
          v-model="form.refuse_reason"
          autocomplete="off"
          :rows="3"
          placeholder="请输入拒绝结算原因"
        ></el-input>
      </el-form-item>
    </el-form>
    <div slot="footer" class="dialog-footer">
      <el-button @click="close">取消</el-button>
      <el-button type="primary" @click="submit_refuse">确定拒绝</el-button>
    </div>
  </el-dialog>
</template>

<script>
import { orderRefuseSettle } from "@/api/finance";
export default {
  props: ['leaseId'],
  data() {
    return {
      dialogVisible: false,
      form: {
        refuse_reason: "",
      },
    };
  },
  methods: {
    close(){
      this.dialogVisible = false;
      this.form= {
        refuse_reason: "",
      }
    },
    submit_refuse(){
      if(!this.form.refuse_reason){
        this.$message.warning('拒绝原因不能为空')
        return false
      }
      let obj = {
        lease_id: this.leaseId,
        refuse_reason: this.form.refuse_reason,
      }
      orderRefuseSettle(obj).then(res =>{
        this.dialogVisible = false;
        this.form= {
          refuse_reason: "",
        }
        this.$parent.getList()
      })
    }
  },
  mounted() {},
};
</script>

<style lang="scss" scoped>
.title {
  text-align: center;
  margin: 30px 0 20px;
}
</style>